//
//  HistoryListModel.m
//  CloudTest
//
//  Created by 张帅 on 2020/7/28.
//  Copyright © 2020 张帅. All rights reserved.
//

#import "HistoryListModel.h"

@implementation HistoryListModel

//字段名映射
+ (NSDictionary *)modelCustomPropertyMapper {
    return @{@"Id" : @"id"};
}


/// 获取订单历史列表
/// @param page 页数
/// @param successBlock successBlock
/// @param errorBlock errorBlock
+ (void)get_history_order_List_page:(NSInteger)page success:(ObjSuccess)successBlock error:(ErrorBlock)errorBlock {
    NSString * url = [NSString stringWithFormat:@"%@pageNumber=%ld",get_OrderList_url,page];
   [NetWorkTools requestWithURLStr:url method:GET params:nil success:^(id responseObject) {
       GDLog(@"订单历史列表 = %@",responseObject);
       if ([AppTools isStateSuccess:responseObject]) {
           NSArray * array=[NSArray new];
           if ([AppTools is_parsing_security_responseObject:responseObject]) {
               NSArray * records = responseObject[@"data"][@"records"];
                array =[NSArray yy_modelArrayWithClass:[HistoryListModel class] json:records];
           }
           if (successBlock) {
               successBlock(array);
           }
       } else {
           if (errorBlock) {
               errorBlock();
           }
       }
   } failure:^(NSError *error) {
       if (errorBlock) {
           errorBlock();
       }
       NSString *errorStr = [self errorDescribe:error];
       [QMUITips showError:errorStr];
   }];
}
- (UIColor *)get_text_color {
    UIColor * color = theme_color;
//   12 订单关闭（未支付）
//    13- 订单关闭（已退款）
//     14 订单关闭（未退款）
//    8 已邮寄
//    5 评审结束
    NSArray * states = @[@"12",@"13",@"8",@"14",@"5",];
    if ([states containsObject:self.orderStatus]) {
        color = RGBA(0, 0, 0, 0.45);
    }
    return color;
}


@end
